﻿//(function(){
//    var input = document.getElementsByTagName("input");
//    var isfocus=false;
//    for(var i = 0; i < input.length; i++){
//	    if(input[i].className == "button"){
//		    input[i].onmouseover = function(){this.className = "button-over";}
//		    input[i].onmouseout = function(){this.className = "button";}
//	    }
//	    if(input[i].type=="text" && !isfocus){
//	       input[i].focus(); 
//	       isfocus=true;
//	    }
//    }
//    if($("#listinfo")!=null&&$("listinof")!="undefined"){
//        CreateTrClass($("listinfo"));
//    }
//    top.setAutoHeight();
//})();
//  
//function CreateTrClass(list){
//    var tr=list.getElementsByTagName("tr");
//    for(var i = 0; i < tr.length; i++){
//        if((i+1)%2==1){
//            tr[i].className="tr1";
//        }else{
//            tr[i].className="";
//        }
//    }
//}
function BindBtn(){
	$(".button").each(function(){
	    $(this).mouseover(function(){$(this).attr("class","button-over");})
	           .mouseout(function(){$(this).attr("class","button");});
	});
}
function getPage(link,title){
	box.attr("src",link);
	$("#mainTxt").html(title);
}
function AddTrClass(obj){
    var count=1;
    obj.find("tr").each(function(){
        if(count%2==1){$(this).attr("class","tr1");
        }else{$(this).attr("class","");}
         $(this).mouseover(function(){$(this).addClass('rowselect');}).mouseout(function(){$(this).removeClass('rowselect');}); 
        count++;
    });
}  

jQuery.extend({
  isEmpty:function(vl){
        return $.trim(vl).length==0;
  },
  isEmail:function(vl) {
        var pattern=/^(([a-zA-Z\-_0-9\.]+)@[a-zA-Z\-_0-9]+\.([a-zA-Z]+(\.)?)?[a-zA-Z]+)$/;
        return pattern.test($.trim(vl));
  },
  isDate:function(vl){
        var pattern=/^((\d{4})(-)([1-9]|0[1-9]|1[0-2])(-)([1-9]|0[1-9]|[12][0-9]|3[01])|([1-9]|0[1-9]|1[0-2])(\/)([1-9]|0[1-9]|[12][0-9]|3[01])(\/)(\d{4})|(\d{4})(\/)([1-9]|0[1-9]|1[0-2])(\/)([1-9]|0[1-9]|[12][0-9]|3[01]))$/;
        return pattern.test($.trim(vl));
  },
  isInt:function(vl){
       var pattern=/^[0-9]*$/;
       return pattern.test($.trim(vl));
  },
  RealLengthBetween:function(vl,min,max){
        var len=$.trim(vl).length;
        if(len<min || len>max)
            return false;
        return true;
  }
});
var doc = document.documentElement;
function Loading(type) {
    if (!$("#loadingDiv").length > 0) {
        $(document.body).append("<div id=\"loadingDiv\" class=\"loadingDiv\"><div class=\"shadow\"></div><div class=\"loadwin\"><div class=\"load-con\">正在处理数据中...</div></div></div>");
    }
    var div = $("#loadingDiv");
    var top = doc.scrollTop + (doc.clientHeight / 2 - 15) + "px";
    var left = (doc.clientWidth - doc.scrollLeft) / 2 - 65 + "px";
    if (type == "show") { div.css({ "top": top, "left": left }); div.show(); }
    else if (type == "hide") { div.hide(); }
}

